<script src="resource/js/yahoo.js"></script>
<script src="resource/js/event.js"></script>
<script src="resource/js/connection.js"></script>
<script src="resource/js/json.js"></script>
<body>
	<div id="container" >&nbsp;</div>
</body>
<script language="javascript">
var div = document.getElementById('container');
var postData = "username=anonymous&userid=0";
	
var handleSuccess = function(o){

	if(o.responseText !== undefined){
		div.innerHTML = "Transaction id: " + o.tId;
		div.innerHTML += "HTTP status: " + o.status;
		div.innerHTML += "Status code message: " + o.statusText;
		div.innerHTML += "<li>HTTP headers: <ul>" + o.getAllResponseHeaders + "</ul></li>";
		div.innerHTML += "PHP response: " + o.responseText;
		div.innerHTML += "Argument object: " + o.argument;
		
		//var str = {"two":"2","one":"1"};
		var result = YAHOO.lang.JSON.parse(o.responseText);
		
		alert(result[0].two);
	}
}

var handleFailure = function(o){

	if(o.responseText !== undefined){
		div.innerHTML = "Transaction id: " + o.tId;
		div.innerHTML += "HTTP status: " + o.status;
		div.innerHTML += "Status code message: " + o.statusText;
		div.innerHTML += "<li>HTTP headers: <ul>" + o.getAllResponseHeaders + "</ul></li>";
		div.innerHTML += "PHP response: " + o.responseText;
		div.innerHTML += "Argument object: " + o.argument;
	}
}


var callback =
{
  success:handleSuccess,
  failure: handleFailure,
  argument: ['foo','bar']
};

var sUrl = "http://localhost/vancl/getGoodInfo.do";
function makeRequest(){

	var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, callback, postData);

}

makeRequest();
//var homogenousMap = {"one": 1, "two": 2, "three": 3};
//alert(homogenousMap['two']);
</script>

